<?php
/**
 * Return instance of the core or its property if provided
 *
 * @param	string	$file
 * @return	string
 */
function operation($xml)
{
	//Run operation
	//For each result item run component

	$compName = ucfirst($xml->getTag());

	//Does souch operation exist?
	$res = core("File")->GetDirContentSelective("classes/structure/operations", $compName."\.class\.php");

	if(empty($res))
	{
		service("debug")->error("Operation $compName doesn't exists");
	}

	service("debug")->TimerStart();

	$component = core()->NewObject("\structure\operations\\$compName", $xml);

	$component->RunPreModifiers();
	$result = $component->Start();
	$component->RunPostModifiers($result);
	$res = $component->Complete();

	$time = service("debug")->TimerStop();

	return $res;
	//return "operation...";
}

/*

function component($xml)
{
//$xml = core("File")->LoadXml($file);
//$xml = core("Html")->CreateElement($sxe);

//Start a specific component only!
$compName = ucfirst($xml->getTag());

//Does souch component exist?
$res = core("File")->GetDirContentSelective("classes/structure/components", $compName."\.class\.php");

if(empty($res))
{
service("debug")->error("Component $compName doesn't exists");
}

service("debug")->TimerStart();

$component = core()->NewObject("\structure\components\\$compName", $xml);

$component->RunPreModifiers();
$result = $component->Start();
$component->RunPostModifiers($result);

$res = $component->Complete();

$time = service("debug")->TimerStop();

service("debug")->LogComponent($compName, $time);//info($compName."($time s)", "Component");

return $res;
}


*/